import json
import requests
from shargeApi.config import *


class Getcode:
    def __init__(self):
        pass

    #获取验证码
    def getcode(self,phone):
        url = url_msg
        json_data = {"msgType":"1","area":"86","mobile":phone} #msgtype区分不同的类型：注册1 登陆9 修改密码
        jsondata= json.dumps(json_data)
        headers = {"Content-Type":"application/json"}
        res = requests.post(url = url,data = jsondata.encode('utf-8'),  headers=headers)

        result = json.loads(res.text)
        # print("\n---------",result)
#
# phone = 11111
# Getcode().getcode(phone)